package org.xg.domain;

import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * 角色表
 * @author xg
 *
 */
@Entity
@Table(name = "SYS_USER")
public class UserVO extends IdEntity {

	private String username;
	private String userCname;
	private String password;
	private String userType;
	private String sex;
	private String email;
	private String phone;
	private Boolean valid;
	
	private Set<User2RoleVO> user2Role;	//用户、角色中间表
	private Set<User2AuthorityVO> user2auth; //用户、权限中间表
	
	public UserVO(){}
	
	@Column(name="VALIDFLAG")
	public Boolean isValid() {
		return valid;
	}

	public void setValid(Boolean valid) {
		this.valid = valid;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getSex() {
		return sex;
	}

	public void setSex(String sex) {
		this.sex = sex;
	}

	public String getPhone() {
		return phone;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public String getUserCname() {
		return userCname;
	}

	public void setUserCname(String userCname) {
		this.userCname = userCname;
	}

	public String getUserType() {
		return userType;
	}

	public void setUserType(String userType) {
		this.userType = userType;
	}

//	@ManyToMany
//	@JoinTable(name = "SYS_R_ROLE2USER", joinColumns = { @JoinColumn(name = "USER_ID") }, inverseJoinColumns = { @JoinColumn(name = "ROLE_ID") })
//	public Set<RoleVO> getRoles() {
//		return roles;
//	}
//
//	public void setRoles(Set<RoleVO> roles) {
//		this.roles = roles;
//	}


	@OneToMany(mappedBy="user")
	public Set<User2RoleVO> getUser2Role() {
		return user2Role;
	}

	public void setUser2Role(Set<User2RoleVO> user2Role) {
		this.user2Role = user2Role;
	}

	@OneToMany(mappedBy="user")
	public Set<User2AuthorityVO> getUser2auth() {
		return user2auth;
	}

	public void setUser2auth(Set<User2AuthorityVO> user2auth) {
		this.user2auth = user2auth;
	}
}
